package Main;

import model.Auktion;
import register.AuktionsRegister;
import view.MainGui;

/**
 *
 * @author Jeppe
 */
public class Main {
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
           try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                }
            }
        } catch (ClassNotFoundException ex) {
               System.out.println(ex.getLocalizedMessage());
        } catch (InstantiationException ex) {
            System.out.println(ex.getLocalizedMessage());
        } catch (IllegalAccessException ex) {
            System.out.println(ex.getLocalizedMessage());
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            System.out.println(ex.getLocalizedMessage());
        }

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                // opretter første view
                MainGui g1 = new MainGui();
                g1.setVisible(true);
                
                // oprette anden view
                MainGui g2 = new MainGui();
                g2.setVisible(true);
                
                // for hver auktion sættes en lytter til hvert view
                for (Auktion auktion : AuktionsRegister.getInstance().getAuktionsList()) {
                    auktion.addListener(g1);
                    auktion.addListener(g2);
                }
            }
        });
        
    }
    
}
